package com.woniuxy.educationplatform.service.impl;

import com.woniuxy.educationplatform.bean.ProjectBean;
import com.woniuxy.educationplatform.bean.SubjectBean;
import com.woniuxy.educationplatform.mapper.SubjectMapper;
import com.woniuxy.educationplatform.service.ISubjectService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class SubjectServiceImpl implements ISubjectService {
    @Resource
    private SubjectMapper subjectMapperImpl;
    @Override
    public SubjectBean findById(Long id) {
        return subjectMapperImpl.findById(id);
    }

    @Override
    public List<SubjectBean> findOneByCondition(Long id, Date createTime) {
        return subjectMapperImpl.findOneByCondition(id,createTime);
    }

    @Override
    public List<SubjectBean> findAll() {
        return subjectMapperImpl.findAll();
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void update(SubjectBean subjectBean) {

    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void saveSubjectBean(SubjectBean subjectBean, Long id) {
            subjectMapperImpl.saveSubjectBean(subjectBean, id);
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void deletdSubjectBean(Long id) {
        subjectMapperImpl.deletdSubjectBean(id);
    }

    @Override
    public Long findIdByName(String subjectName) {

        return subjectMapperImpl.findIdByName(subjectName);
    }

    @Override
    public String[] getSubjectName() {
        return subjectMapperImpl.getSubjectName();
    }


}
